package com.linked.goods.goodsbase.service.impl;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.linked.goods.goodsbase.bean.dto.GoodsBrandDTO;
import com.linked.goods.goodsbase.bean.po.GoodsBrandPO;
import com.linked.goods.goodsbase.mapper.IGoodsBrandInfoMapper;
import com.linked.goods.goodsbase.service.IGoodsBrandService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author :dbq
 * @date : 2023/5/17 9:03
 * @description : desc
 */
@Service
@Slf4j
public class GoodsBrandServiceImpl implements IGoodsBrandService {

    private final IGoodsBrandInfoMapper goodsBrandInfoMapper;

    private final ObjectMapper mapper;

    public GoodsBrandServiceImpl(IGoodsBrandInfoMapper goodsBrandInfoMapper, ObjectMapper mapper) {
        this.goodsBrandInfoMapper = goodsBrandInfoMapper;
        this.mapper = mapper;
    }

    @Override
    public String saveGoodsBrand(GoodsBrandPO goodsBrandPO) throws Exception {
        goodsBrandInfoMapper.insert(goodsBrandPO);
        return goodsBrandPO.getGoodsBrandId();
    }

    @Override
    public List<GoodsBrandDTO> queryAllBrandList(GoodsBrandDTO param) {
        return goodsBrandInfoMapper.queryAllBrandList(param);
    }
}
